#ifndef ROBOTWIDGET_H
#define ROBOTWIDGET_H

#include <QWidget>
#include <QGLWidget>
#include "model.h"
#include <GL/glut.h>
#include "ui_robotwidget.h"

class RobotWidget : public QGLWidget
{
    Q_OBJECT
public:
    explicit RobotWidget(QWidget *parent = 0);
    void glPrint(const char *fmt, ...);             //输出字符串
    GLfloat joint1=0;
    GLfloat joint2=0;
    GLfloat joint3=0;
    GLfloat joint4=0;
    GLfloat joint5=0;
    GLfloat joint6=1740.0f;
    float m_xRot=0.0f;
    float m_yRot=0.0f;
    float m_zRot=0.0f;
    bool m_Light;                                   //灯光
    ~RobotWidget();

protected:
    void initializeGL();
    void resizeGL(int w, int h);
    void paintGL();
    void keyPressEvent(QKeyEvent *event);           //处理键盘按下事件
    void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
    void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
private:
    QPoint m_lastPos;
    bool fullscreen;                                //是否全屏显示
    void buildFont();                               //创建字体
    void killFont();                                //删除显示列表
//    HDC m_HDC;                                      //储存当前设备的指针
    GLuint m_Base;                                  //储存绘制字体的显示列表的开始位置
public slots:
    void setXRotation(int angle);
    void setYRotation(int angle);
    void setZRotation(int angle);
};

#endif // ROBOTWIDGET_H
